import { data } from "jquery"
import {request} from "./index"

export function loginApi(data) {
  return request({
    url: "member/login",
    method: "post",
    data
  })
}

export function createCodeAPi() {
  return request({
    url: "code",
    method: "get"
  })
}

// 个人信息
export function getInfoApi() {
  return request({
    url: "info",
    method: "get"
  })
}

// 公告信息
export function getNoticeApi(params) {
  return request({
    url: "notice",
    method: "get",
    params
  })
}

// 公告详情
export function getNoticeDetailApi(id) {
  return request({
    url: `notice/${id}`,
    method: "get",
  })
}
// 教练
export function getCoachListApi(params) {
  return request({
    url: "coach",
    method: "get",
    params
  })
}
export function getCoachDetailApi(id) {
  return request({
    url: `coach/${id}`,
    method: "get",
  })
}
// 课程
export function getCourseListApi(params) {
  return request({
    url: "course",
    method: "get",
    params
  })
}
export function getRecommendListApi() {
  return request({
    url: "course/recommend",
    method: "get",
  })
}

// 课程一览
export function getCourseDetailApi(id) {
  return request({
    url: `course/${id}`,
    method: "get",
  })
}

// 选课
export function getProgrammeListApi(params) {
  return request({
    url: `coach/course/page`,
    method: "get",
    params
  })
}

export function postMemberCourseApi(data) {
  return request({
    url: `member/course`,
    method: "POST",
    data
  })
}

export function registerApi(data) {
  return request({
    url: `member/register`,
    method: "POST",
    data
  })
}


export function getMemberCourseListApi(params) {
  return request({
    url: `member/course`,
    method: "get",
    params
  })
}

// 用户登出
export function logoutApi() {
  return request({
    url: `logout`,
    method: "POST"
  })
}

// 教练登录
export function coachLogoutApi(data) {
  return request({
    url: `coach/login`,
    method: "POST",
    data
  })
}

export function getLoveListApi() {
  return request({
    url: `type/list`,
    method: "GET"
  })
}

// 评价新增
export function evaluateApi(data) {
  return request({
    url: `evaluate`,
    method: "POST",
    data
  })
}
// 编辑
export function editEvaluateApi(data) {
  return request({
    url: `evaluate`,
    method: "put",
    data
  })
}

export function getEvaluateApi(params) {
  return request({
    url: `evaluate`,
    method: "get",
    params
  })
}

export function evaluateDetailApi(id) {
  return request({
    url: `member/course/${id}`,
    method: "get"
  })
}
// 轮播图
export function getImageApi() {
  return request({
    url: `image`,
    method: "get"
  })
}

// 修改个人信息
export function putMemberApi(data) {
  return request({
    url: `member/update`,
    method: "PUT",
    data
  })
}

// 申请会员
export function applyVipApi(data) {
  return request({
    url: `member/apply`,
    method: "POST",
    data
  })
}

// 我的评价
export function memberEvaluateApi(params) {
  return request({
    url: `evaluate/member`,
    method: "get",
    params
  })
}

// 我的评价详情
export function memberEvaluateDetailApi(id) {
  return request({
    url: `evaluate/member/detail?memberCourseId=${id}`,
    method: "get"
  })
}
// 评价删除
export function deleteEvaluateApi(id) {
  return request({
    url: `evaluate/batch?ids=${id}`,
    method: "DELETE"
  })
}
// 教练的课程
export function coachCourseApi(params) {
  return request({
    url: `coach/course/my`,
    method: "GET",
    params
  })
}
// 修改密码
export function updatePasswordApi(data) {
  return request({
    url: `member/update/password`,
    method: "put",
    data
  })
}

// 修改密码
export function updateCoachApi(data) {
  return request({
    url: `coach/update`,
    method: "put",
    data
  })
}

// 申请记录最新
export function getApplyInfoApi() {
  return request({
    url: `member/apply/info`,
    method: "GET"
  })
}
